﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BacklogParser.Models
{
    public class OfficeSpecificBibData
    {
        public OfficeSpecificBibData()
        {
            this.AppealData = new List<EpAppealData>();
            this.RevocationProcedure = new List<EpRevocationProcedure>();
            this.PetitionReview = new List<EpPetitionReview>();
            this.LimitationProcedure = new List<EpLimitationProcedure>();
        }

        public List<EpAppealData> AppealData { get; set; }

        public List<EpRevocationProcedure> RevocationProcedure { get; set; }

        public List<EpPetitionReview> PetitionReview { get; set; }

        public List<EpLimitationProcedure> LimitationProcedure { get; set; }

        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.AppendLine("OfficeSpecificBibData");

            Print(builder, AppealData);
            Print(builder, RevocationProcedure);
            Print(builder, PetitionReview);
            Print(builder, LimitationProcedure);


            return builder.ToString();
        }

        private static void Print<T>(StringBuilder builder, List<T> list)
        {
            foreach (var item in list)
                builder.AppendLine("    " + item.ToString());
        }
    }

    public class EpAppealData
    {
        public string Date { get; set; }

        public string DateStatementsOfGroundsFiled { get; set; }

        public string DateInterlocutoryRevision { get; set; }

        public string AppealResult { get; set; }

        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.AppendLine("Appeal Data");
            builder.AppendLine("    Date                            " + Date);
            builder.AppendLine("    DateStatementsOfGroundsFiled    " + DateStatementsOfGroundsFiled);
            builder.AppendLine("    DateInterlocutoryRevision       " + DateInterlocutoryRevision);
            builder.AppendLine("    AppealResult                    " + AppealResult);

            return builder.ToString();
        }
    }

    public class EpRevocationProcedure
    {
        public string ProcedureDate { get; set; }

        public string ProcedureDecision { get; set; }

        public string ProcedurePaid { get; set; }

        public string DateDispatch { get; set; }
        
        public string LegalEffect { get; set; }

        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.AppendLine("Revocation Procedure");
            builder.AppendLine("    ProcedureDate       " + ProcedureDate);
            builder.AppendLine("    ProcedureDecision   " + ProcedureDecision);
            builder.AppendLine("    ProcedurePaid       " + ProcedurePaid);
            builder.AppendLine("    DateDispatch        " + DateDispatch);
            builder.AppendLine("    LegalEffect         " + LegalEffect);

            return builder.ToString();
        }
    }

    public class EpPetitionReview
    {
        public string ReviewAppealNumber { get; set; }

        public string ReviewDate { get; set; }

        public string ReviewPetitionerCode { get; set; }

        public string ReviewDecisionDate { get; set; }

        public string ReviewKind { get; set; }

        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.AppendLine("Petition Review");
            builder.AppendLine("    ReviewAppealNumber      " + ReviewAppealNumber);
            builder.AppendLine("    ReviewDate              " + ReviewDate);
            builder.AppendLine("    ReviewPetitionerCode    " + ReviewPetitionerCode);
            builder.AppendLine("    ReviewDecisionDate      " + ReviewDecisionDate);
            builder.AppendLine("    ReviewKind              " + ReviewKind);

            return builder.ToString();
        }
    }

    public class EpLimitationProcedure
    {
        public string FilingDate { get; set; }

        public string FilingDecision { get; set; }

        public string RejectionKind { get; set; }

        public string RejectionDispatchDate { get; set; }

        public string RejectionLegalDate { get; set; }

        public string AllowedDispatchDate { get; set; }

        public string AllowedRequestPayDate { get; set; }

        public override string ToString()
        {
            var builder = new StringBuilder();

            builder.AppendLine("Limitation Procedure");
            builder.AppendLine("    FilingDate              " + FilingDate);
            builder.AppendLine("    FilingDecision          " + FilingDecision);
            builder.AppendLine("    RejectionKind           " + RejectionKind);
            builder.AppendLine("    RejectionDispatchDate   " + RejectionDispatchDate);
            builder.AppendLine("    RejectionLegalDate      " + RejectionLegalDate);
            builder.AppendLine("    AllowedDispatchDate     " + AllowedDispatchDate);
            builder.AppendLine("    AllowedRequestPayDate   " + AllowedRequestPayDate);


            return builder.ToString();
        }
    }
}
